﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;

namespace WeiXinWeb.Filter
{
    public class FilterBrowser : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext actionContext)
        {
            var cc= actionContext.HttpContext.Request.Headers.GetValues("user-Agent")[0];
            var tt = System.Configuration.ConfigurationManager.AppSettings["filterbrowser"];
            if (tt=="true")
            {
                if (cc.Contains("MicroMessenger"))
                {
                   // base.OnActionExecuting(actionContext);
                }
                else
                {
                    actionContext.HttpContext.Response.Redirect("/Login/BrowserError");
                }
            }
            base.OnActionExecuting(actionContext);
        }
    }
}